Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: validateExpression on Radio button group
Feedback Type: Problem
Product Area: Domino Designer on Eclipse (DDE)
Technical Area: Functionality
Platform: Windows XP client
Release: 8.5.1
Reproducible: Always

I have two date fields and a radio button group on my Xpage. If a value is selected from the radio button group, which is not a required field, the values of the two date fields should be the same. I added a validateExpression to the radio button group to check that this was the case. Here's my expression...


var from = getComponent("dateFrom").getValue();
var to = getComponent("dateTo").getValue();

if (value == "AM" | value == "PM") {
return from==to
}


This works when the user selects a value from the radio button group and the dateFrom and dateTo are different. I get my friendly custom error. However, if I subsequently make my dates the same the error is still thrown. I've tried using getSubmittedValue, but that's null. Has anyone got any ideas? My source code is below so that you can have a go.


<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.data>
<xp:dominoDocument var="dominoDocument1"
computeWithForm="onsave" formName="inputLeaveRequest"
action="openDocument">
<xp:this.postSaveDocument><![CDATA[#{javascript:ag = database.getAgent("submitRequest");
noteid = dominoDocument1.getDocument().getNoteID();
ag.run(noteid) }]]></xp:this.postSaveDocument>
</xp:dominoDocument>
</xp:this.data>

<xp:this.resources>




<xp:styleSheet href="/core.css"></xp:styleSheet>
<xp:styleSheet href="/custom.css"></xp:styleSheet>
<xp:styleSheet href="/defaultTheme.css"></xp:styleSheet>
</xp:this.resources>



<xp:this.beforePageLoad><![CDATA[#{javascript://add the name to the session scope
var userName:NotesName = session.createName(@UserName());
sessionScope.name = (userName.getCommon());

//add the logname to the session scope
var userName:NotesName = session.createName(@UserName());
var nab = new Array("Callisto/TFI","names.nsf");
var shortName = @DbLookup(nab,"($Users)",userName.getCommon(),"ShortName");
sessionScope.logname = shortName;}]]></xp:this.beforePageLoad>



<xp:div>

<xp:table border="0" style="width:600px" styleClass="lotusTable"
id="dateControlTable">

<xp:tr>
<xp:td style="width:125.0px">
<xp:label value="Date from" id="label3" style="font-weight:bold"></xp:label>
</xp:td>
<xp:td style="width:475.0px">
<xp:inputText id="dateFrom"
value="#{dominoDocument1.From}" required="true"
disableClientSideValidation="true">




<xp:this.defaultValue><![CDATA[#{javascript:var datefrom = @Date(@Today());
return(datefrom)}]]></xp:this.defaultValue>


<xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>




<xp:this.converter>
<xp:convertDateTime type="date"
dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
<xp:message id="message1" for="dateFrom"></xp:message>
</xp:td>

</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Date to" id="label2" style="font-weight:bold"></xp:label>
</xp:td>
<xp:td>
<xp:inputText id="dateTo" required="true"
value="#{dominoDocument1.To}"
disableClientSideValidation="true">




<xp:this.defaultValue><![CDATA[#{javascript:getComponent("dateFrom").getValue()}]]></xp:this.defaultValue>

<xp:this.validators>
<xp:validateDateTimeRange
message="Please select a date that's after your from date.">
<xp:this.minimum><![CDATA[#{javascript:var fromDate = getComponent("dateFrom");
var value = fromDate.getSubmittedValue();
if( value == null ){
// else not yet submitted
value = fromDate.getValue();
}}]]></xp:this.minimum>
</xp:validateDateTimeRange>
</xp:this.validators>
<xp:dateTimeHelper id="dateTimeHelper2"></xp:dateTimeHelper>

<xp:this.converter>
<xp:convertDateTime type="date"
dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
<xp:message id="message2" for="dateTo"></xp:message>
</xp:td>

</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:table border="0" style="width:600px" styleClass="lotusTable"
id="timeControlTable">


<xp:tr>
<xp:td style="width:125.0px">
<xp:label value="Half day?" id="label9" style="font-weight:bold"></xp:label></xp:td>
<xp:td style="width:475.0px">

<xp:radioGroup id="radioGroup1">



<xp:this.validators>
<xp:validateExpression>

<xp:this.message><![CDATA[#{javascript:"Date from and to should be the same for half day requests"}]]></xp:this.message>









<xp:this.expression><![CDATA[#{javascript:var from = getComponent("dateFrom").getValue();
var to = getComponent("dateTo").getValue();

return from==to}]]></xp:this.expression>

</xp:validateExpression>
</xp:this.validators>
<xp:selectItem itemLabel="AM" itemValue="AM"></xp:selectItem>
<xp:selectItem itemLabel="PM" itemValue="PM"></xp:selectItem>
</xp:radioGroup>

<xp:message id="message5" for="radioGroup1"></xp:message></xp:td>
</xp:tr>

<xp:tr>
<xp:td rendered="false">
<xp:label value="Time from" id="label4" style="font-weight:bold"></xp:label>
</xp:td>
<xp:td rendered="false">
<xp:inputText id="timeFrom"
value="#{dominoDocument1.TimeFrom}" required="true"
disableClientSideValidation="true">






<xp:this.validators>
<xp:validateRequired
message="Please enter a start time">
</xp:validateRequired>
</xp:this.validators>
<xp:dateTimeHelper id="dateTimeHelper3"></xp:dateTimeHelper>





<xp:this.converter>
<xp:convertDateTime type="time"
timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
<xp:message id="message3" for="dateFrom"></xp:message>
</xp:td>

</xp:tr>
<xp:tr>
<xp:td rendered="false">
<xp:label value="Time to" id="label5" style="font-weight:bold"></xp:label>
</xp:td>
<xp:td rendered="false">
<xp:inputText id="timeTo" required="true"
value="#{dominoDocument1.TimeTo}"
disableClientSideValidation="true">






<xp:this.validators>
<xp:validateRequired
message="Please enter an end time">
</xp:validateRequired>
</xp:this.validators>
<xp:dateTimeHelper id="dateTimeHelper4"></xp:dateTimeHelper>


<xp:this.converter>
<xp:convertDateTime type="time"
timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
<xp:message id="message4" for="dateTo"></xp:message>
</xp:td>

</xp:tr>
</xp:table>


<xp:br></xp:br>
<xp:table style="width:600.0px">
<xp:tr>
<xp:td style="width:125.0px">

</xp:td>
<xp:td style="width:475.0px">
<xp:button value="Amend Request" id="button4"
rendered="#{javascript:!dominoDocument1.isEditable()}"
styleClass="lotusBtnSpecial" style="font-weight:bold">

<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" id="eventHandler2">
<xp:this.action>

<xp:actionGroup>
<xp:changeDocumentMode
mode="edit">
</xp:changeDocumentMode>


<xp:modifyField name="RequestStatus"
value="Amended">
</xp:modifyField>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Submit" id="button1"
styleClass="lotusBtnSpecial" style="font-weight:bold" rendered="#{javascript:dominoDocument1.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="false" save="false" id="eventHandler3">
<xp:this.action>

<xp:actionGroup>










<xp:save
name="/leaveRequests.xsp">
</xp:save>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Cancel" id="button3" styleClass="lotusBtnSpecial" style="font-weight:bold">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" save="false" immediate="true">
<xp:this.action>
<xp:openPage name="/leaveRequests.xsp"></xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button></xp:td>
</xp:tr>

</xp:table>
<xp:br></xp:br></xp:panel>






<xp:this.navigationRules>
<xp:navigationRule outcome="xsp-success"
viewId="/leaveRequests.xsp">
</xp:navigationRule>

</xp:this.navigationRules>
</xp:view>


Feedback number WEBB7X2GKJ created by ~Sean Quetnuynds on 10/21/2009

Status: Open
Comments:





Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS